$OpenBSD: patch-bzgrep,v 1.1 2014/05/24 20:51:55 naddy Exp $
--- bzgrep.orig	Wed Jan  3 03:00:55 2007
+++ bzgrep	Fri May 23 23:23:11 2014
@@ -63,10 +63,12 @@ for i do
     bzip2 -cdfq "$i" | $grep $opt "$pat"
     r=$?
   else
-    j=${i//\\/\\\\}
-    j=${j//|/\\|}
-    j=${j//&/\\&}
-    j=`printf "%s" "$j" | tr '\n' ' '`
+    j=$(printf '%s\n' "$i" |
+        sed '
+          $!N
+          $s/[&\|]/\\&/g
+          $s/\n/ /g
+        ')
     bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
     r=$?
   fi
